<?php

namespace App\Jobs;

use Illuminate\Support\Facades\DB;

class ApplicationLog extends Job
{
    const QUEUE_NAME = '{default}';
    private $data = null;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($data)
    {
        //
        $this->data = $data;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        DB::table('application_log')->insert([
            'content' => json_encode($this->data,JSON_UNESCAPED_UNICODE),
            'created_at' => date('Y-m-d H:i:s'),
        ]);
    }
}
